from django.db import models
# 案件表
class Anjian(models.Model):
    aj_xingzhi = models.CharField(max_length=2, verbose_name="案件程序", choices=(("1", "一般程序"), ("2", "简易程序")))
    ajzl = (('1', '动监'), ('2', '畜牧'), ('3', '饲料'), ('4', '兽药'), ('5', '屠宰'), ('6', '种子'),
            ('7', '肥料'), ('8', '农药'), ('9', '生鲜乳'), ('10', '农产品'), ('11', '农机管理'),
            ('12', '渔业水产'), ('13', '资源利用'), ('14', '农业转基因'), ('15', '其他'))
    aj_zhonglei = models.CharField(max_length=2, verbose_name="案件种类", choices=ajzl)
    ajly = (('1', '检查发现'), ('2', '群众举报'), ('3', '群众投诉'), ('4', '部门移送'), ('5', '上级交办'), ('6', '媒体曝光'), ('7', '监督抽检'),
            ('8', '违法人交代'))
    aj_laiyuan = models.CharField(max_length=2, verbose_name="案件来源", choices=ajly)
    aj_time1 = models.DateField(verbose_name="立案时间")
    aj_anyou = models.CharField(max_length=54, verbose_name="案由")
    aj_dangshiren = models.CharField(max_length=32, verbose_name="当事人（单位）")
    aj_faren = models.CharField(max_length=32, verbose_name="法定代表人（负责人）", null=True, blank=True)
    aj_jigoudaima = models.CharField(max_length=32, verbose_name="违法企业组织机构代码", null=True, blank=True)
    aj_sheanjine = models.IntegerField(verbose_name="涉案金额（元）")
    aj_time2 = models.DateField(verbose_name="结案（移交）时间", null=True, blank=True)
    ajzt = (("1", "立案"), ("2", "结案"), ("3", "移交司法"), ("4", "移交其他单位"), ("5", "行政复议中"), ("6", "复议决定维持"), ("7", "复议决定不维持"),
            ("8", "行政诉讼中"), ("9", "行政诉讼胜诉"), ("10", "行政诉讼败诉"))
    aj_zhuangtai = models.CharField(max_length=2, verbose_name="案件状态", default="1", choices=ajzt)
    aj_juedingshu = models.CharField(max_length=2, verbose_name="行政处罚决定书文号", null=True, blank=True)
    aj_chufayiju = models.CharField(max_length=2, verbose_name="行政处罚依据（法律条款）", null=True, blank=True)
    aj_chufajine = models.IntegerField(verbose_name="处罚金额（元）",default=0)
    aj_heiwodian = models.CharField(max_length=2, verbose_name="是否捣毁黑窝点", default="2", choices=(("1", "是"), ("2", "否")))
    aj_wfss = models.TextField(verbose_name="主要违法事实")
    aj_user = models.ForeignKey("UserInfo", verbose_name="执法人员", on_delete=models.CASCADE)
    sb_time = models.DateTimeField(auto_now_add=True, verbose_name="上报时间")
    xg_time = models.DateTimeField(auto_now=True, verbose_name="修改时间")
    sheng = models.CharField(max_length=10, verbose_name="省")
    shi = models.CharField(max_length=10, verbose_name="市")
    xian = models.CharField(max_length=10, verbose_name="县")


#决定书/移交函
class Pic(models.Model):
    Anjian = models.ForeignKey("Anjian", verbose_name="案件ID", on_delete=models.CASCADE)
    pic = models.FileField(upload_to="pictures/", verbose_name="决定书/移交函")
    class Meta:
        verbose_name = "决定书/移交函"
        verbose_name_plural = verbose_name
